package com.worldtolearn.offer.dao;

import java.io.Serializable;
import java.util.List;

import org.hibernate.SessionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
import org.springframework.stereotype.Repository;

import com.worldtolearn.offer.entity.Adress;

@Repository
public class AdressDao extends HibernateDaoSupport implements IAdressDao, Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	@Autowired
	public void init(SessionFactory factory) {
	    setSessionFactory(factory);
	}

	@Override
	public void createAdresse(Adress adresse) {
		getHibernateTemplate().save(adresse);
	}

	@Override
	public void deleteAdresse(Adress adresse) {
		getHibernateTemplate().delete(adresse);
	}

	@Override
	public List<Adress> getAllAdresse() {
		List<Adress> list = getHibernateTemplate().find("from Adress");
		return list;
	}

}
